package com.thrd.basicframework.ui.webview;

import android.content.Context;
import android.util.Log;
import android.webkit.JavascriptInterface;
import android.widget.Toast;

import com.alibaba.android.arouter.launcher.ARouter;
import com.thrd.basicframework.utils.LogUtil;

/**
 * @author: ${唐杰}
 * @date: 2021/3/26
 */
public class JSTest {
    private Context mContext;

    public JSTest(Context context) {
        mContext = context;
    }

    @JavascriptInterface
    public void showToast(String str) {
        Toast.makeText(mContext, str, Toast.LENGTH_SHORT).show();
    }
    @JavascriptInterface
    public void setJumpEnterprise(int companyId){
        LogUtil.e("JSTest","setJumpEnterprise");
        ARouter.getInstance().build("/app/enterprise") .navigation();

    }

    @JavascriptInterface
    public void openImage(String img) {
        //点击跳转查看图片
        Log.e("JSInterface","log="+img);
    }

    //调试用的，可以删掉
    @JavascriptInterface
    public void log(String log) {
        // Timber.d("log: %s", log);
        Log.e("JSInterface","log="+log);
    }
}
